
function toggle() {
    var source = "tests/";
    var target = "out/test-results/";

    var location = "" + document.location.href;
    var inSourceTree = location.indexOf(source) > -1;
    var inTargetTree = location.indexOf(target) > -1;

    if (!inSourceTree && !inTargetTree ) {
        alert("You have messed up your directory trees, so toggle will not work:\n"
            + source + "\n"
            + target);
    }

    document.location = inSourceTree ? location.replace(source, target) : location.replace(target, source);
}
